package szkeleton;

import szkeleton.Element.Type;


public class Door extends Element{
	public Door(){
		if (Controller.isDebug()) System.out.println("Door konstructor");
		
		
		opened = false;
		type = Type.d;
		Gamelogic.setDoor(this);
	}
	
	private boolean opened;
	
	public boolean isOpen(){
		return opened;
	}
	
	public void open(){
		opened = true;
	}
	
	public void collide(Player player){
		if(opened) player.win();//todo
		else player.whiteCollided();
	}

	@Override
	public boolean isCompatible(Element e) {
		if(e.getTipe() == Type.bp) return false;
		else return true;
	}
}